.card {
  width: 100%;
  max-width: 600px;
}

.generateContainer {
  padding: 20px;
  text-align: center;

  h3 {
    margin-bottom: 16px;
    font-size: 18px;
    color: #333;
  }

  p {
    color: #666;
    font-size: 14px;
  }
}

.container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
  box-sizing: border-box;
}

// 内容区域容器（编辑器和预览）
.contentContainer {
  display: flex;
  width: 100%;
  gap: 16px;
  min-height: 500px;
  height: calc(100vh - 200px);
  flex: 1;
  overflow: hidden; 
  box-sizing: border-box;
}

// 左侧编辑区域
.editorSection {
  width: 50%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
  box-sizing: border-box;
}

// AI助手部分
.aiAssistantSection {
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  overflow: hidden;
  background-color: white;
}

.aiAssistantHeader {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background-color: #f0f7ff;
  border-bottom: 1px solid #d9d9d9;
}

.aiIcon {
  color: #1677ff;
  font-size: 16px;
}

.aiPromptContainer {
  display: flex;
  padding: 12px;
  gap: 8px;
  min-height: 100px;
  align-items: center;
  background-color: #fafafa;
}

.aiPrompt {
  flex: 1;
  resize: none;
  border-radius: 4px;
  font-size: 14px;
}

.sendButton {
  white-space: nowrap;
}

// 编辑器区域
.editorContainer {
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  box-sizing: border-box;
}

// 编辑器头部样式
.editorHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid #f0f0f0;
  background-color: #fafafa;
  
  h3 {
    margin: 0;
    font-size: 16px;
    color: #333;
  }
}

// 自动保存提示样式
.autoSaveIndicator {
  color: #52c41a;
  font-size: 12px;
}

.saveButton {
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  height: 32px;
  font-weight: 500;
  padding: 0 16px;
}

.editorWrapper {
  flex: 1;
  overflow: auto;
  position: relative;
  min-height: 0;
  height: 100%;
  box-sizing: border-box;
  
  &::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }
  
  &::-webkit-scrollbar-track {
    background: #1e1e1e;
  }
  
  &::-webkit-scrollbar-thumb {
    background-color: #4a4a4a;
    border-radius: 5px;
  }
  
  &::-webkit-scrollbar-thumb:hover {
    background: #5a5a5a;
  }
  
  scrollbar-width: thin;
  scrollbar-color: #4a4a4a #1e1e1e;
  
  :global {
    .cm-editor {
      height: 100% !important;
      font-family: 'Fira Code', 'Consolas', monospace;
      font-size: 14px;
      line-height: 1.5;
      box-sizing: border-box;
    }

    .cm-scroller {
      overflow: auto !important;
      
      &::-webkit-scrollbar {
        width: 10px;
        height: 10px;
      }
      
      &::-webkit-scrollbar-track {
        background: #1e1e1e;
      }
      
      &::-webkit-scrollbar-thumb {
        background-color: #4a4a4a;
        border-radius: 5px;
      }
      
      &::-webkit-scrollbar-thumb:hover {
        background: #5a5a5a;
      }
      
      scrollbar-width: thin;
      scrollbar-color: #4a4a4a #1e1e1e;
    }

    .cm-content {
      white-space: pre;
      height: auto !important;
      min-height: 100%;
    }

    .cm-lineNumbers {
      font-family: 'Fira Code', 'Consolas', monospace;
    }

    .cm-gutters {
      background: #1e1e1e;
      border-right: 1px solid #333;
    }

    .cm-activeLineGutter {
      background: #2a2a2a;
    }

    .cm-activeLine {
      background: #2a2a2a;
    }
  }
}

// 预览区域
.previewContainer {
  width: 50%;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background-color: white;
  box-shadow: none;
  outline: none;
  height: 100%;
  box-sizing: border-box;
}

.previewHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  border-bottom: 1px solid #d9d9d9;
  background-color: #f5f5f5;
  z-index: 10;
  flex-shrink: 0;

  h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: #333;
  }
}

.previewContent {
  flex: 1;
  position: relative;
  border: none;
  outline: none;
  padding: 0;
  margin: 0;
  overflow: auto;
  
  &::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }
  
  &::-webkit-scrollbar-track {
    background: #f5f5f5;
  }
  
  &::-webkit-scrollbar-thumb {
    background-color: #c1c1c1;
    border-radius: 5px;
  }
  
  &::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
  }
  
  scrollbar-width: thin;
  scrollbar-color: #c1c1c1 #f5f5f5;
}

.loadingContainer {
  width: 100%;
  height: 100%;
  background-color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 300px;
}

.previewFrame {
  border: none;
  outline: none;
  background-color: white;
  box-shadow: none;
  padding: 0;
  margin: 0;
}

.buttonContainer {
  display: none; /* 隐藏旧的按钮容器 */
}

.codeMirrorContainer {
  position: relative;
  height: 100%;
  min-height: 300px;
  width: 100%;
  overflow: hidden;
}

.extraSpace {
  height: 200px;
  width: 100%;
}

// 差异比较样式
.diffContainer {
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: 100%;
  overflow: auto;
}

.diffSection {
  flex: 1;
  border: 1px solid #e8e8e8;
  border-radius: 4px;
  padding: 10px;
  background-color: #fafafa;
  
  h3 {
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: 500;
  }
}

.codeBlock {
  white-space: pre-wrap;
  word-wrap: break-word;
  background-color: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 10px;
  max-height: 400px;
  overflow: auto;
  font-family: 'Courier New', Courier, monospace;
  font-size: 14px;
  line-height: 1.5;
}

.promptText {
  font-size: 14px;
  color: #888;
  font-weight: normal;
}

// 新增：确认对话框样式
.confirmationContainer {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: calc(90vh - 200px);
  overflow: auto;
}

.previewSection {
  margin-top: 20px;
  border: 1px solid #e8e8e8;
  border-radius: 4px;
  padding: 10px;
  background-color: #fafafa;
  
  h3 {
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: 500;
  }
}

.previewFrame {
  width: 100%;
  height: 400px;
  border: 1px solid #ddd;
  border-radius: 4px;
  overflow: hidden;
  background-color: white;
}

// 流式响应容器样式
.streamingContainer {
  margin-top: 12px;
  border: 1px solid #e8e8e8;
  border-radius: 4px;
  background-color: #f8f8f8;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.streamingHeader {
  padding: 8px 12px;
  background-color: #f0f0f0;
  border-bottom: 1px solid #e8e8e8;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.streamingSpinner {
  margin-left: 8px;
  color: #1890ff;
}

.streamingContent {
  padding: 0;
  max-height: 300px;
  overflow-y: auto;
  background-color: #1e1e1e; // 深色背景，类似代码编辑器
  position: relative;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
  font-size: 13px;
  line-height: 1.5;
  scrollbar-width: thin;
  scrollbar-color: #666 #1e1e1e;
  
  &::-webkit-scrollbar {
    width: 8px;
  }
  
  &::-webkit-scrollbar-track {
    background: #1e1e1e;
  }
  
  &::-webkit-scrollbar-thumb {
    background-color: #666;
    border-radius: 4px;
  }
}

.streamingLoading {
  padding: 16px;
  text-align: center;
  color: #fff;
  font-size: 14px;
  
  :global(.anticon) {
    margin-right: 8px;
  }
}

.streamingError {
  padding: 16px;
  text-align: center;
  color: #ff4d4f;
  font-size: 14px;
  background-color: rgba(255, 77, 79, 0.1);
  margin-top: 12px;
  border-radius: 4px;
  
  :global(.anticon) {
    margin-right: 8px;
  }
  
  span {
    margin-left: 8px;
  }
}

.streamingCode {
  padding: 8px 0;
  counter-reset: line;
}

.streamingLine {
  padding: 0 16px 0 48px;
  position: relative;
  min-height: 20px;
  color: #d4d4d4;
  white-space: pre-wrap;
  word-break: break-all;
  
  // 添加行号
  &:before {
    counter-increment: line;
    content: counter(line);
    position: absolute;
    left: 0;
    top: 0;
    width: 40px;
    padding-right: 8px;
    text-align: right;
    color: #858585;
    user-select: none;
  }
  
  // 简单的语法高亮
  :global {
    .tag, .keyword {
      color: #569cd6;
    }
    
    .attribute {
      color: #9cdcfe;
    }
    
    .string {
      color: #ce9178;
    }
    
    .comment {
      color: #6a9955;
    }
  }
  
  // 最后一行添加光标闪烁效果
  &:last-child:after {
    content: '';
    display: inline-block;
    width: 2px;
    height: 14px;
    background-color: #fff;
    margin-left: 2px;
    vertical-align: middle;
    animation: blink 1s step-end infinite;
  }
}

@keyframes blink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

// 生成状态指示器
.generatingIndicator {
  display: flex;
  align-items: center;
  margin-right: 10px;
  background-color: rgba(24, 144, 255, 0.1);
  color: #1890ff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  
  .generatingIcon {
    margin-right: 5px;
    font-size: 14px;
  }
}

// 预览等待消息
.previewWaitingMsg {
  display: flex;
  align-items: center;
  color: #1890ff;
  font-size: 12px;
  margin-right: 10px;
}

// 修复滚动问题
html, body {
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

// 全局滚动条样式，取消以前的设置
:global {
  *::-webkit-scrollbar {
    width: auto;
    height: auto;
  }
}

// 设置iframe的滚动条样式
iframe {
  &::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }
  
  &::-webkit-scrollbar-track {
    background: #f5f5f5;
  }
  
  &::-webkit-scrollbar-thumb {
    background-color: #c1c1c1;
    border-radius: 5px;
  }
  
  &::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
  }
} 